home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!patriot
- From: greinerk@ix.netcom.com (Kurt W. Greiner)
- Newsgroups: comp.lang.c++
- Subject: cin.get(string) problem
- Date: Sun, 11 Feb 96 05:48:44 GMT
- Organization: The ESCape Club
- Message-ID: <4fk02a$nh@reader2.ix.netcom.com>
- NNTP-Posting-Host: ix-clv4-10.ix.netcom.com
- X-NETCOM-Date: Sat Feb 10 9:50:04 PM PST 1996
- X-Newsreader: News Xpress 2.0 Beta #0
-
- Hi all,
- i was trying some really simple io for a program that just gets
- values, here is a sample of code
-
- #include <iostream.h>
-
- void main(void)
- {
- char string[80];
- cin.get(string,sizeof(string));
- cin.get(string,sizeof(string));
- }
-
- ok, say i want to read in a name on the first cin, i type in "john smith" and
- the prompt, john gets thrown in to the first and smith the second, i do not
- even get prompted for the second cin. it does not happen if i type in a string
- with out spaces. i am using borland c++ 2.0, am i doing something wrong or is
- there an other way of doing this other than gets(string)?
-
- kurt
-